package com.yitiao.base.delay;

import io.netty.util.HashedWheelTimer;

import java.util.Date;
import java.util.concurrent.TimeUnit;

public class DelayedTaskWithNettyExample {
    public static void main(String[] args) {
        HashedWheelTimer timer = new HashedWheelTimer();
        System.out.println(new Date());
        // 延迟5秒执行任务
        timer.newTimeout(
                timeout -> System.out.println("Delayed task executed "+new Date()),
                5, TimeUnit.SECONDS
        );
    }
}
